package com.mohan.common.exception;

import com.mohan.common.result.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptiobHandler {
  @ExceptionHandler(YyghException.class)  // 如果加了这个配置表示如果有异常，则会走这个方法
  @ResponseBody
  public Result error(Exception e) {
    e.printStackTrace();
    return Result.fail();
  }
}
